@extends('shop::layouts.master')
@section('title') 商品规格属性列表 @endsection
@section('tab')
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body ">
                        <form class="layui-form layui-col-space5">
                            <div class="layui-input-inline layui-show-xs-block">
                                <input type="text" name="refund_no" placeholder="退单编号"
                                       value="{{$arr_search['refund_no']}}"
                                       autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-input-inline layui-show-xs-block" style="width: 150px;">
                                <select name="apply_state" id="order_type">
                                    <option value="">状态</option>
                                    <option value="1" @if($arr_search['apply_state']==1) selected @endif>待处理</option>
                                    <option value="2" @if($arr_search['apply_state']==2) selected @endif>已处理</option>
                                    <option value="3" @if($arr_search['apply_state']==3) selected @endif>已拒绝</option>
                                    <option value="4" @if($arr_search['apply_state']==4) selected @endif>已退款</option>
                                </select>
                            </div>
                            <div class="layui-input-inline layui-show-xs-block">
                                <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                    <i class="layui-icon">&#xe615;</i>
                                </button>
                                <button class="layui-btn" onclick="location.reload()">
                                    <i class="layui-icon layui-icon-refresh"></i>
                                </button>
                                @if(!empty($data))
                                    <a id="export" class="layui-btn layui-btn-small">导出</a>
                                @endif
                            </div>
                        </form>
                    </div>
                    <div class="layui-card-body layui_overflow_y ">
                        <table class="layui-table layui-form">
                            <thead>
                            <tr>
                                <th>退单编号</th>
                                <th>状态</th>
                                <th>类型</th>
                                <th>退款金额</th>
                                <th width="30%">原因</th>
                                <th>申请时间</th>
                                <th>处理时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if(!empty($data))
                                @foreach($data as $key=>$value)
                                    <tr>
                                        <td>{{$value['refund_no']}}</td>
                                        <td>
                                            @if($value['apply_state'] == 1)待处理
                                            @elseif($value['apply_state'] == 2)已处理
                                            @elseif($value['apply_state'] == 3)已拒绝
                                            @elseif($value['apply_state'] == 4)已退款
                                            @else未知
                                            @endif
                                        </td>
                                        <td>
                                            @if($value['apply_type'] == 1)退款
                                            @elseif($value['apply_type'] == 2)退货（退款）
                                            @elseif($value['apply_type'] == 3)退货退款
                                            @else未知
                                            @endif
                                        </td>
                                        <td>{{$value['refund_amount']}}</td>
                                        <td>【{{$value['refund_reason_id']['reason']}}】 {{$value['refund_reason']}}</td>
                                        <td>{{$value['created_at']}}</td>
                                        <td>{{$value['deal_at']?? ' -- '}}</td>
                                        <td class="td-manage">
                                            <a title="详情"
                                               onclick="parent.xadmin.add_tab('售后详情','{{route("shop_store_order_refund_detail",["id"=>$value["id"]])}}',$(window).width(),$(window).height())"
                                               href="javascript:;">【售后详情】</a></br>
                                            <a title="详情"
                                               onclick="parent.xadmin.add_tab('订单详情','{{route("shop_store_order_detail",["id"=>$value["store_order_id"]])}}',$(window).width(),$(window).height())"
                                               href="javascript:;">【订单详情】</a></br>
                                        </td>
                                    </tr>
                                @endforeach
                            @else
                                <td colspan="66" align="center">暂无数据</td>
                            @endif
                            </tbody>
                        </table>
                    </div>
                    <div class="layui-card-body ">
                        <div class="page">
                            {{$page_link}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

@endsection

@section('tab_js')
    <script type="text/javascript">
        $(document).on('click', '#export', function () {
            location_redirect('shop-store-order-refund-export' + window.location.search);
        });
    </script>
@endsection




